<script setup>
const props = defineProps({
  isLegend: String,
  icon: {
    type: Object,
    require: true,
  },
});

const iconUrl = computed(() => {
  const type = props.icon.方法 === "是" ? "png" : "svg";
  return props.isLegend === "0"
    ? `url('/mapres/plot/used/${props.icon.key}.${type}')`
    : `url('/mapres/plot/used/${props.icon.key}.${type}')`;
});

const click = (item) => {
  this.$emit("click", item);
};
</script>
<template>
  <div
    class="plot-icon"
    :style="{ background: `${iconUrl} center/contain no-repeat` }"
  ></div>
</template> 
<style lang="scss" scoped>
.plot-icon {
  width: 20px;
  height: 20px;
  background: red;
  cursor: pointer;
}
</style>